package lambda;

import java.util.function.IntBinaryOperator;

public class _02 {
    public static void main(String[] args) {
        //普通
        int i = calculateNum(new IntBinaryOperator() {
            @Override
            public int applyAsInt(int left, int right) {
                return left + right;
            }
        });
        //第一次简化
        int i1 = calculateNum((int left, int right)->{
            return left + right;
        });
        // alt+enter idea快捷键简化 可还原
        int i2 = calculateNum((left, right) -> left + right);
        System.out.println("i=="+i);
        System.out.println("i1=="+i1);
        System.out.println("i2=="+i2);
    }
    public static int calculateNum(IntBinaryOperator operator){
        int a = 10;
        int b = 20;
        return operator.applyAsInt(a,b);
    }
}
